package com.zycfc.zsf.boot.job.autoconfigure;

import org.springframework.boot.autoconfigure.*;
import com.zycfc.zsf.boot.core.autoconfigure.*;
import org.springframework.boot.context.properties.*;
import org.springframework.boot.autoconfigure.condition.*;
import org.springframework.core.env.*;
import org.springframework.beans.factory.annotation.*;
import com.zycfc.zsf.boot.job.*;
import org.springframework.context.annotation.*;

@Configuration
@AutoConfigureAfter({ CommonLoadConfiguration.class })
@EnableConfigurationProperties({ ZookeeperProperties.class })
@ConditionalOnProperty(value = { "zsf.boot.job.zk.enabled" }, matchIfMissing = true)
public class RegisterConfiguration
{
    private ZookeeperProperties zookeeperProperties;
    @Autowired
    private Environment env;
    
    public RegisterConfiguration(final ZookeeperProperties zookeeperProperties) {
        this.zookeeperProperties = zookeeperProperties;
    }
    
    @Bean
    @DependsOn({ "springContextHelper" })
    public ZsfJobStartupRunner zsfJobStartupRunner() {
        return new ZsfJobStartupRunner(this.zookeeperProperties, this.env);
    }
}
